<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="${ctx!}/assets/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${ctx!}/assets/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="${ctx!}/assets/css/animate.css" rel="stylesheet">
    <link href="${ctx!}/assets/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="${ctx!}/assets/css/admin-main.css" rel="stylesheet">
    <link href="${ctx!}/assets/css/alarm.css" rel="stylesheet">

    <style>
        label {
            color: white;
        }

        .ibox-content {
            border: transparent!important;
            background-color: #12212f!important;
        }

        .ibox {
            border: transparent!important;
        }

        textarea, input, select {
            display: inline-block!important;
            width: 400px!important;
        }

        .form-group div, .form-group label {
            display: inline-block!important;
        }

        .btn-box {
            position:absolute;
            right:15px;
            bottom:5px;
        }

        .btn-box button {
            display: inline;
        }


        body {
            background-color: #12212f;
        }
    </style>

</head>

<body >
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <form class="form-horizontal m-t" id="frm" method="post" action="${ctx!}/web/project/usage/edit">
                            <input type="hidden" id="status" name="status" value="true">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">设备组名称：</label>
                                <div class="col-sm-8">
                                    <input id="category_name" name="category_name" class="form-control" type="text" >
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">&#12288;选择设备：</label>
                                <div class="col-sm-8">
                                        <select class="form_select form-control" id="device_id" name="device_id">
                                        <#list devices as device>
                                            <option value=${device.id} >${device.name}--${device.template.name}--${device.template.tag}</option>
                                        </#list>
                                        </select>
                                </div>
                            </div>

                            <div style="margin-top: 50px" class="form-group">
                                <div class="col-sm-8 col-sm-offset-3 btn-box">
                                    <button class=" btn a_add" type="submit">确认</button>
                                    <button class=" btn a_add" onclick="back()" type="reset">取消</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>



    <!-- 全局js -->
    <script src="${ctx!}/assets/js/jquery.min.js?v=2.1.4"></script>
    <script src="${ctx!}/assets/js/bootstrap.min.js?v=3.3.6"></script>

    <!-- 自定义js -->
    <script src="${ctx!}/assets/js/content.js?v=1.0.0"></script>

    <!-- jQuery Validation plugin javascript-->
    <script src="${ctx!}/assets/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${ctx!}/assets/js/plugins/validate/messages_zh.min.js"></script>
    <script src="${ctx!}/assets/js/plugins/layer/layer.min.js"></script>
    <script src="${ctx!}/assets/js/plugins/layer/laydate/laydate.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {

	    $("#frm").validate({
    	    rules: {
                category_name: {
                    required: true,
                },
                device_id: {
                    required: true,
                },
            },
    	    messages: {},
    	    submitHandler:function(form){
    	    	$.ajax({
   	    		   type: "POST",
   	    		   dataType: "json",
   	    		   url: "${ctx!}/web/project/data/edit",
   	    		   data: $(form).serialize(),
   	    		   success: function(msg){
	   	    			layer.msg(msg.message, {time: 2000},function(){
	   						var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
	   						parent.layer.close(index); 
	   					});
   	    		   }
   	    		});
            } 
    	});
    });
    </script>

</body>

</html>
